package com.rupertjones.globalcron.server.scheduling;

import com.rupertjones.globalcron.common.scheduling.GlobalCronScheduler;
import org.apache.log4j.Logger;
import org.springframework.jms.core.JmsTemplate;

public class ReloadingConfigurationJob {
    private static final Logger LOG = Logger.getLogger(ReloadingConfigurationJob.class);
    private GlobalCronScheduler scheduler;
    private JmsTemplate outgoingMessagesTemplate;

    public ReloadingConfigurationJob(GlobalCronScheduler scheduler) {
        this.scheduler = scheduler;
    }

    public void execute() {
        outgoingMessagesTemplate.convertAndSend("this is a message");
        scheduler.adjustForModifications();
    }

    public JmsTemplate getOutgoingMessagesTemplate() {
        return outgoingMessagesTemplate;
    }

    public void setOutgoingMessagesTemplate(JmsTemplate outgoingMessagesTemplate) {
        this.outgoingMessagesTemplate = outgoingMessagesTemplate;
    }
}
